<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets position for text output</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ps-set-text-pos" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ps_set_text_pos</h1>
  <p class="verinfo">(PECL ps &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_set_text_pos</span> &mdash; <span class="dc-title">Sets position for text output</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ps-set-text-pos-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ps_set_text_pos</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$x</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Set the position for the next text output. You may alternatively set the x
   and y value separately by calling <span class="function"><a href="ps_set_value.html" class="function">ps_set_value()</a></span> and
   choosing <em>textx</em> respectively <em>texty</em> as
   the value name.
  </p>
  <p class="para">
   If you want to output text at a certain position it is more convenient
   to use <span class="function"><a href="ps_show_xy.html" class="function">ps_show_xy()</a></span> instead of setting the text position
   and calling <span class="function"><a href="ps_show.html" class="function">ps_show()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ps-set-text-pos-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">psdoc</code></dt>

     <dd>

      <p class="para">
       Resource identifier of the postscript file
       as returned by <span class="function"><a href="ps_new.html" class="function">ps_new()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">x</code></dt>

     <dd>

      <p class="para">
       x-coordinate of the new text position.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">y</code></dt>

     <dd>

      <p class="para">
       y-coordinate of the new text position.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ps-set-text-pos-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ps-set-text-pos-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4231">
    <p><strong>Example #1 Placing text at a given position</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$ps&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ps_new</span><span style="color: #007700">();<br />if&nbsp;(!</span><span style="color: #0000BB">ps_open_file</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"text.ps"</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"Cannot&nbsp;open&nbsp;PostScript&nbsp;file\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;exit;<br />}<br /><br /></span><span style="color: #0000BB">ps_set_info</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Creator"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"rectangle.php"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_set_info</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Author"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Uwe&nbsp;Steinmann"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_set_info</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Title"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Text&nbsp;placement&nbsp;example"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">ps_begin_page</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">596</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">842</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$psfont&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ps_findfont</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Helvetica"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_setfont</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$psfont</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">8.0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_show_xy</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Some&nbsp;text&nbsp;at&nbsp;(100,&nbsp;100)"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">ps_set_value</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"textx"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_set_value</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"texty"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">120</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_show</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Some&nbsp;text&nbsp;at&nbsp;(100,&nbsp;120)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ps_end_page</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">ps_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$ps</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ps-set-text-pos-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ps_set_value.html" class="function" rel="rdfs-seeAlso">ps_set_value()</a> - Sets certain values</span></li>
    <li class="member"><span class="function"><a href="ps_show.html" class="function" rel="rdfs-seeAlso">ps_show()</a> - Output text</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>